﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml;
using System.Text;

namespace Admx_Generator
{
    public class DecimalTextBoxPresentation : IPresentationElement
    {
        public DecimalTextBoxPresentation(string refId, string value)
        {
            this.RefId = refId;
            this.Value = value;
            this.DefaultValue = 1;
            this.Spin = true;
            this.SpinStep = 1;
        }

        private string RefId { get; set; }
        private string Value { get; set; }
        public uint DefaultValue { get; set; }
        public bool Spin { get; set; }
        public uint SpinStep { get; set; }

        public void Save(XmlWriter xmlWriter)
        {
            // decimalTextBox
            xmlWriter.WriteStartElement("decimalTextBox");
            xmlWriter.WriteAttributeString("refId", this.RefId);
            xmlWriter.WriteAttributeString("defaultValue", this.DefaultValue.ToString());
            xmlWriter.WriteAttributeString("spin", this.Spin.ToString().ToLower());
            xmlWriter.WriteAttributeString("spinStep", this.SpinStep.ToString());
            xmlWriter.WriteValue(this.Value);
            xmlWriter.WriteEndElement(); // decimalTextBox
        }
    }
}
